import request from '@/utils/request';

const API = {
    GETLEAVESAVE: 'v1/biz/leaves/save?',
    GETLEAVEDETAIL: 'v1/biz/leaves/one/',
    GETSTAYDETAIL: 'v1/biz/leaves/dormitory/',
    PUTSAVE: 'v1/biz/leaves/save',
    GETFILES: 'biz/Files/picture?id=',
    GETINFO: 'v1/biz/students/info/',
    GETALLLEAVES: 'v1/biz/leaves/saveAll?'
};

export const reqLeaveSave = (pn, ps) =>
    request.get(`${API.GETLEAVESAVE}pageNo=${pn}&pageSize=${ps}`);

export const reqLeaveDetail = id => request.get(`${API.GETLEAVEDETAIL}${id}/`);

export const reqStayDetail = id => request.get(`${API.GETSTAYDETAIL}${id}/`);

export const reqPutSave = data => request.put(API.PUTSAVE, data);

export const reqGetFiles = id =>
    request.get(`${API.GETFILES}${id}`, {
        responseType: 'blob'
    });

export const reqGetInfo = num => request.get(`${API.GETINFO}${num}/`);

//str(states=1&pageNo=1&pageSize=6)
export const reqAllLeave = str => request.get(`${API.GETALLLEAVES}${str}`);
